home *** CD-ROM | disk | FTP | other *** search
- ATARI MACHINE SPECIFIC LIBRARY
-
-
-
- NAME
- Screen - support for Atari standard resolution screens
-
- SYNOPSIS
- #include <Screen.h>
-
- class Screen
-
- DESCRIPTION
- When writing machine specific programs, the Atari programmer will
- often work directly with screen images. Many drawing programs
- exist for creating screen images, so these are a logical base for
- developing graphical applications.
-
- Regardless of screens displayed during a program, the original
- display and colour palette are restored upon termination.
-
- CLASSES
- The class Screen encapsulates the concept of a screen image.
- A Screen's image can be transfered to and from disk, displayed,
- and modified. All Screen-modifying routines are in other modules.
-
- Screens are memory areas (possibly extending above and below the
- visible area) with palettes. Palettes are fairly independent, but
- are included here, because most picture file formats include the
- palette in the file.
-
- CLASS MEMBERS
- Screen::
-
- Screen()
- A screen for the current resolution
-
- Screen(const Screen&)
- A screen with a duplicate image and palette of another screen
-
- Screen(Resolution)
- A screen for a specific resolution
-
- Screen(Resolution, short LinesAbove, short LinesBelow)
- A screen for a specific resolution, with extra memory allocated
- above and below the normal bounds of the screen.
-
- Screen(short LinesAbove, short LinesBelow)
- A screen for the current resolution, with extra memory allocated
- above and below the normal bounds of the screen.
-
- Screen(long *At)
- A screen using the memory at a specific location.
- If the constant DESKSCREEN is used, the location of the current
- screen is used.
-
- Screen(const char *filename)
- A screen as specified in the given picture file.
- May cause !() to be true (ie. it may fail - if the file is bad).
-
- int operator !()
- 'does-not-exist' operator (eg. init file not found)
-
- void Clear()
- Clear the screen.
-
- void ShowPalette()
- Change the current palette to that of the screen.
-
- void Show(); // Physically show
- Change the current physically displayed screen to this one.
- (Note: refer to DoubleBuffer for more useful interface)
-
- void Use()
- Change the current logically active screen to this one.
- (Note: refer to DoubleBuffer for more useful interface)
-
- short* Color()
- short* Colour()
- Returns array of RGB. eg: scr.Colour()[4]=0x123
-
- char *Location()
- Returns the displayable area of the screen (ie. does not
- include "lines above" or "line below" that are specified
- in some constructors).
-
- Resolution Rez()
- Returns the resolution associated with a given screen.
-
- int Load(const char*);
- int LoadPalette(const char *);
- Load in format appropriate to filename extension, or if no
- extension, then whichever file can be found by adding a supported
- file format extension.
-
- int Save(const char*);
- Save in format appropriate to filename extension.
-
- These routines access the file formats explicitly:
- int LoadDegas(const char *);
- int SaveDegas(const char *);
- int LoadDegasPalette(const char *);
- int LoadCrackArtPalette(const char *);
- int LoadCrackArt(const char *);
- int SaveCrackArt(const char *, int Compression=3);
- Compression 0 = minimal compression attempt
- Compression 8 = maximal compression attempt
-
- USAGE
- Newly created Screens are NOT cleared. The programmer will usually
- clear them, or load images into them.
-
- FILES
- The LoadDegas and SaveDegas routines support TT resolutions as
- logical extensions (all still have 16 colours, except TTLow which
- has 256 colours). LoadCrackArt and SaveCrackArt routines also
- support TT resolutions logically.
-
- Note that CrackArt is a compressed format.
-
- Load(filename) and Save(filename) methods use these extensions:
-
- CrackArt Degas Resolution Getrez()
- CA1 PI1 STLow 0
- CA2 PI2 STMedium 1
- CA3 PI3 STHigh 2
- CA8 PI8 TTLow 7
- CA5 PI5 TTMedium 4
- CA6 PI6 TTHigh 5
-
- ie.
- "CA"+('1'+Resolution)
- "PI"+('1'+Resolution)
-
- For further details of these formats, the best source is
- Dave Baggett's "ST Picture Formats" document (picfmts.doc),
- and the AMS library sources.
-
- Note that at time of writing, the CrackArt CA3 format as
- specified by the CrackArt authors had a slight bug in that
- it does not save the palette. This probably arose because
- the CrackArt drawing program is a low-resolution only program,
- and so the format was never really used. The problem is not
- very relevant on the ST since STHigh is monochrome anyway, but
- on the TT, STHigh can have any two arbitrary colours.
-
- SEE ALSO
- Resolution, DoubleBuffer, EasySprite
-
- DIAGNOSTICS
- When Screen objects are created with the Screen(char *) method
- (ie. load from file), the programmer should chech the success
- by using operator!(), for example:
-
- Screen foo("foo.pi1");
- if (!foo) {
- printf("failed!\n");
- exit(1);
- }
-
- Also, Load*() and Save*() methods return a success value. 0 for
- failure, non-0 for success. For example:
-
- Screen foo;
-
- if (foo.Load("foo.pi1")) {
- printf("failed!\n");
- exit(1);
- }
-
- BUGS
- Screen::Show() does not change the resolution. This is because
- the standard TOS routine to do this also clears the screen, which
- is not the usual requirement.
-
- AUTHOR
- Warwick Allison, 1992.
- warwick@cs.uq.oz.au
-
- COPYING
- This functionality is part of the Atari Machine Specific Library,
- and is Copyright 1992 by Warwick W. Allison.
-
- The Atari Machine Specific Library is free and protected under the
- GNU Library General Public License.
-
- You are free to copy and modify these sources, provided you acknowledge
- the origin by retaining this notice, and adhere to the conditions
- described in the GNU LGPL.
-